package com.nvn.washiodriver.utils;

import java.util.ArrayList;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

import com.nvn.washiodriver.Objects.Order;
import com.nvn.washiodriver.Objects.OrderStatus;

public class SessionManager {
	private static SessionManager mSessionManager;
	private static final String PREFS_FILE = "com.nvn.washiodriver.session";

	private Order curOrder;
	private ArrayList<OrderStatus> oStatuses = new ArrayList<OrderStatus>();
	
	private SessionManager(Context context) {
		
	}

	public static SessionManager getSessionManager(Context context) {
		if (mSessionManager == null) {
			mSessionManager = new SessionManager(context);
		}
		return mSessionManager;
	}

	public static void destroySession() {
		mSessionManager = null;
	}

	public static void clear(Context context) {
		SharedPreferences pref = context.getSharedPreferences(PREFS_FILE,
				Context.MODE_PRIVATE);
		Editor editor = pref.edit();
		editor.clear();
		editor.commit();
	}

	public ArrayList<OrderStatus> getoStatuses() {
		return oStatuses;
	}

	public void setoStatuses(ArrayList<OrderStatus> oStatuses) {
		this.oStatuses = oStatuses;
	}

	public Order getCurOrder() {
		return curOrder;
	}

	public void setCurOrder(Order curOrder) {
		this.curOrder = curOrder;
	}

	
}
